#include <stdio.h>


int main() {
    char s1[100];
	char s2[100];
	scanf("%s", &s1);
	scanf("%s", &s2);

	char *maxS;
	char *minS;
	 int lenMax;
	 int lenMin;
	 int len1 = strlen(s1);
	 int len2 =strlen(s2);

	 if(len1>len2)
	 {
		lenMax = len1;
		lenMin = len2;
		maxS = s1;
		minS = s2 ;
	 }
	 else{
		lenMax = len2;
		lenMin = len1;
		maxS = s2;
		minS = s1 ;		
	 }

	 int i;
	int max = 0;
	 for(i=0;i<lenMin;i++)
	 {
		int j;
		char c = minS[i];
		for(j=0;j<lenMax;j++)
		{
			if(c==maxS[j])
			{
				int index = 0;
				while (maxS[index+j] == minS[index+i] )
				{
					index++;
					if(i+index>= lenMax || i+index>= lenMin)
					break;
				}
				if(index > max)
					max = index;
			}
		}
	 }
	 printf("%d",max);
    return 0;
}